﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.effects {
    import Engine.Classes.*;
    import Engine.Events.*;
    import flash.display.*;
    import Classes.*;
    import com.greensock.*;

    public class PoofEffect extends AnimationEffect {

        protected static const ACTION_BAR_OFFSET:int = 8;

        private var m_appearFrame:int;

        public function PoofEffect(_arg1:MapResource, _arg2:String, _arg3:uint=17){
            super(_arg1, _arg2);
            this.m_appearFrame = _arg3;
            this.hideBaseImage();
            _arg1.alpha = 0;
        }
        override public function animate(_arg1:uint):Boolean{
            var _local3:AnimatedBitmap;
            var _local2:Boolean = super.animate(_arg1);
            if (m_effectImage){
                _local3 = (m_effectImage as AnimatedBitmap);
                if (((_local3.isPlaying) && ((_local3.currentFrame >= this.m_appearFrame)))){
                    this.showBaseImage();
                };
            };
            return (_local2);
        }
        override public function cleanUp():void{
            super.cleanUp();
            this.showBaseImage();
            m_mapResource.setActionBarOverrideY(0);
        }
        override protected function onItemImageLoaded(_arg1:LoaderEvent):void{
            super.onItemImageLoaded(_arg1);
            this.hideBaseImage();
            if (m_mapResource.getItemName() == "NPC_lumberjack"){
                m_mapResource.setActionBarOverrideY(ACTION_BAR_OFFSET);
            };
        }
        protected function hideBaseImage():void{
            var _local1:DisplayObject;
            if (m_mapResource.content){
                _local1 = (m_mapResource.content as DisplayObject);
                m_mapResource.alpha = 1;
                _local1.alpha = 0;
            };
        }
        protected function showBaseImage():void{
            var _local1:DisplayObject;
            if (((m_mapResource) && (m_mapResource.content))){
                _local1 = (m_mapResource.content as DisplayObject);
                TweenLite.to(_local1, 0.5, {alpha:1});
            };
        }

    }
}//package Classes.effects 
